using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableCopyChapterDao:DaoBase<TableCopyChapter>
    {
        public override void AddPrimaryIndex(TableCopyChapter model)
        {
            cachePrimary[model.ChapterId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableCopyChapter.txt";
        }

        protected override TableCopyChapter ParseRowData(string[] rowData)
        {
            TableCopyChapter data = new TableCopyChapter();
			data.ChapterId = rowData [0];

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.ChapterSequence = 0;
            }
            else
            {
                data.ChapterSequence = int.Parse(rowData[1]);
            }
			data.ChapterIcon = rowData [2];
			data.ChapterName = rowData [3];

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.BoxCondition0 = 0;
            }
            else
            {
                data.BoxCondition0 = int.Parse(rowData[4]);
            }
			data.Box0 = rowData [5];

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.BoxCondition1 = 0;
            }
            else
            {
                data.BoxCondition1 = int.Parse(rowData[6]);
            }
			data.Box1 = rowData [7];

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.BoxCondition2 = 0;
            }
            else
            {
                data.BoxCondition2 = int.Parse(rowData[8]);
            }
			data.Box2 = rowData [9];

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.LevelLimit = 0;
            }
            else
            {
                data.LevelLimit = int.Parse(rowData[10]);
            }

            return data;
        }



    }

}
